************************************judge percent over time

use HKCFA_u.dta, clear 


gen na = "Foreign" if  position_foreignnonper == 1 &  position_uknonper == 0
replace na = "UK" if position_foreignnonper == 0 &  position_uknonper == 1
replace na = "Foreign & UK" if position_foreignnonper == 1 &  position_uknonper == 1
replace na = "No Foreign/UK" if position_foreignnonper == 0 &  position_uknonper == 0

gen o = 1 if na == "Foreign"  
replace o = 2 if na == "UK"
replace o = 3 if na == "Foreign & UK"
replace o = 4 if na == "No Foreign/UK"

gen countme = 1


graph bar (count) countme, over(na, lab(nolab) sort(o)) over(year, label(labsize(vsmall))) stack asyvars percent bar(1, fcolor(navy) lcolor(black) ) bar(2, fcolor(purple) lcolor(black) )  bar(3, fcolor(cranberry) lcolor(black) ) bar(4, fcolor(eltblue) lcolor(black)) graphregion(color(white)) legend(size(small)) ylabel(, nogrid) b1title(year) ytitle("Percent")

graph export results/Judge_percent.pdf, replace

graph bar (count) countme if gov == 1, over(na, lab(nolab) sort(o)) over(year, label(labsize(vsmall))) stack asyvars percent bar(1, fcolor(navy) lcolor(black) ) bar(2, fcolor(purple) lcolor(black) )  bar(3, fcolor(cranberry) lcolor(black) ) bar(4, fcolor(eltblue) lcolor(black)) graphregion(color(white)) legend(size(small)) ylabel(, nogrid) b1title(year) ytitle("Percent")

graph export results/Judge_percent_public.pdf, replace

graph bar (count) countme if gov == 0, over(na, lab(nolab) sort(o)) over(year, label(labsize(vsmall))) stack asyvars percent bar(1, fcolor(navy) lcolor(black) ) bar(2, fcolor(purple) lcolor(black) )  bar(3, fcolor(cranberry) lcolor(black) ) bar(4, fcolor(eltblue) lcolor(black)) graphregion(color(white)) legend(size(small)) ylabel(, nogrid) b1title(year) ytitle("Percent")

graph export results/Judge_percent_private.pdf, replace


